{extend name="admin@public/basic" /}
{block name="style"}
<link rel="stylesheet" href="__STATIC__/css/admin/public.css" media="all"/>
<link rel="stylesheet" type="text/css" href="__STATIC__/plugs/wangEditor-3.1.1/release/wangEditor.min.css"/>
<link href="__STATIC__/plugs/tag-it/css/jquery.tagit.css" rel="stylesheet" type="text/css">
<link href="__STATIC__/plugs/tag-it/css/tagit.ui-zendesk.css" rel="stylesheet" type="text/css">
<style>
    .toolbar {
        border: 1px solid #ccc;
    }

    .edit-bg {
        border: 1px solid #ccc;
        background-color: #f4f4f4;
        min-height: 300px;
    }
</style>
{/block}
{block name="cotent"}
<form class="layui-form form-width-admin" action="" id="formBox">

        <div class="layui-form-item">
        <label for="cm_num" class="layui-form-label">{:__('cm_num')}:</label>
        <div class="layui-input-block">
            <input id="cm_num" class="layui-input" name="cm_num" type="number">
        </div>
    </div>
    <div class="layui-form-item">
        <label for="bd_num" class="layui-form-label">{:__('bd_num')}:</label>
        <div class="layui-input-block">
            <input id="bd_num" class="layui-input" name="bd_num" type="number">
        </div>
    </div>
    <div class="layui-form-item">
        <label for="period_num" class="layui-form-label">{:__('period_num')}:</label>
        <div class="layui-input-block">
            <input id="period_num" lay-verify="required" class="layui-input" name="period_num" type="number" value="1">
        </div>
    </div>
    <div class="layui-form-item">
        <label for="unit_num" class="layui-form-label">{:__('unit_num')}:</label>
        <div class="layui-input-block">
            <input id="unit_num" class="layui-input" name="unit_num" type="number">
        </div>
    </div>
    <div class="layui-form-item">
        <label for="houses_num" class="layui-form-label">{:__('houses_num')}:</label>
        <div class="layui-input-block">
            <input id="houses_num" class="layui-input" name="houses_num" type="text">
        </div>
    </div>
    <div class="layui-form-item">
        <label for="name" class="layui-form-label">{:__('name')}:</label>
        <div class="layui-input-block">
            <input id="name" class="layui-input" name="name" type="text">
        </div>
    </div>
    <div class="layui-form-item">
        <label for="phone" class="layui-form-label">{:__('phone')}:</label>
        <div class="layui-input-block">
            <input id="phone" class="layui-input" name="phone" type="text">
        </div>
    </div>
    <div class="layui-form-item">
        <label for="user_unit" class="layui-form-label">{:__('user_unit')}:</label>
        <div class="layui-input-block">
            <input id="user_unit" class="layui-input" name="user_unit" type="text">
        </div>
    </div>
    <div class="layui-form-item">
        <label for="houses_area" class="layui-form-label">{:__('houses_area')}:</label>
        <div class="layui-input-block">
            <input id="houses_area" class="layui-input" name="houses_area" type="number">
        </div>
    </div>
    <div class="layui-form-item">
        <label for="public_num" class="layui-form-label">{:__('public_num')}:</label>
        <div class="layui-input-block">
            <input id="public_num" class="layui-input" name="public_num" type="number">
        </div>
    </div>
    <div class="layui-form-item">
        <label for="num_area" class="layui-form-label">{:__('num_area')}:</label>
        <div class="layui-input-block">
            <input id="num_area" class="layui-input" name="num_area" type="number">
        </div>
    </div>
    <div class="layui-form-item">
        <label for="type" class="layui-form-label">{:__('type')}:</label>
        <div class="layui-input-block">
                        
            <select  id="type" lay-verify="required" class="layui-input selectpicker" name="type">
                {foreach name="typeList" item="vo"}
                    <option value="{$key}" {in name="key" value="1"}selected{/in}>{$vo}</option>
                {/foreach}
            </select>

        </div>
    </div>
    <div class="layui-form-item">
        <label for="labels_id" class="layui-form-label">{:__('labels_id')}:</label>
        <div class="layui-input-block">
                        
            <select  id="labels_id" class="layui-input selectpicker" name="labels_id">
                {foreach name="labelsIdList" item="vo"}
                    <option value="{$key}" {in name="key" value=""}selected{/in}>{$vo}</option>
                {/foreach}
            </select>

        </div>
    </div>
    <div class="layui-form-item">
        <label for="in_time" class="layui-form-label">{:__('in_time')}:</label>
        <div class="layui-input-block">
            <input id="in_time" class="layui-input datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="in_time" type="text" value="{:date('Y-m-d H:i:s')}">
        </div>
    </div>
    <div class="layui-form-item">
        <label for="in_message" class="layui-form-label">{:__('in_message')}:</label>
        <div class="layui-input-block">
            <input id="in_message" class="layui-input" name="in_message" type="text">
        </div>
    </div>
    <div class="layui-form-item">
        <label for="pay_time" class="layui-form-label">{:__('pay_time')}:</label>
        <div class="layui-input-block">
            <input id="pay_time" class="layui-input datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="pay_time" type="text" value="{:date('Y-m-d H:i:s')}">
        </div>
    </div>
    <div class="layui-form-item">
        <label for="remarks" class="layui-form-label">{:__('remarks')}:</label>
        <div class="layui-input-block">
            <input id="remarks" class="layui-input" name="remarks" type="text">
        </div>
    </div>
    <div class="layui-form-item">
        <label for="status" class="layui-form-label">{:__('status')}:</label>
        <div class="layui-input-block">
                        
            {foreach name="statusList" item="vo"}
            <input type="radio" name="status" value="{$key}" title="{$vo}" {in name="key" value="1"}checked="checked"{/in}><div class="layui-unselect layui-form-radio layui-form-radioed"><i class="layui-anim layui-icon layui-anim-scaleSpring"></i><div>{$vo}</div></div>
            {/foreach}
        </div>
    </div>
    <div class="layui-form-item">
        <label for="is_deleted" class="layui-form-label">{:__('is_deleted')}:</label>
        <div class="layui-input-block">
            <input id="is_deleted-switch" lay-verify="required" lay-skin="switch" lay-filter="switchis_deleted" lay-text="是|否" type="checkbox" name="is_deleted" value="1">
        </div>
    </div>

    <div class="layui-form-item layui-row layui-col-xs12">
        <div class="layui-input-block">
            <button class="layui-btn layui-btn-sm" id="submitBtn">提交</button>
            <button class="layui-btn layui-btn-sm layui-btn-primary" data-close="closeOpen">取消</button>
        </div>
    </div>
</form>
{/block}

{block name="script"}
<script type="text/javascript" src="/static/plugs/tag-it/js/jquery-ui.min.js"></script>
<script type="text/javascript" src="__STATIC__/plugs/tag-it/js/tag-it.js" charset="utf-8"></script>
<script type="text/javascript" src="__STATIC__/plugs/wangEditor-3.1.1/release/wangEditor.min.js"></script>
<script type="text/javascript">
    layui.use(['form', 'layedit', 'laydate', 'upload'], function () {
        var form = layui.form
            , layer = layui.layer
            , layedit = layui.layedit
            , upload = layui.upload
            , laydate = layui.laydate;

        /**
         * 上传图片处理
         */
        $.form.imageRender('upload_image_div', 'one');

        /**
         * 日期范围
         */
        $.laydate.range('create_at');

        /**
         *编辑器初始化
         */
        var editor = new Array;
        var $text = new Array;
        var E = window.wangEditor;
        $('.layui-textarea').each(function(i){
            var id = $(this).siblings('.layui-input-line').attr('id');
            console.log($(this).siblings('.layui-input-line').attr('id'));
            editor[i] = new E('#'+id);
            editor[i].customConfig.uploadImgServer = "{:url('@admin/api.upload/image')}";
            editor[i].customConfig.uploadFileName = 'image';
            editor[i].customConfig.pasteFilterStyle = false;
            editor[i].customConfig.uploadImgMaxLength = 5;
            editor[i].customConfig.uploadImgHooks = {
                timeout: function (xhr, editor) {
                    $.msg.error('上传超时！')
                },
                // 如果服务器端返回的不是 {errno:0, data: [...]} 这种格式，可使用该配置
                customInsert: function (insertImg, result, editor) {
                    console.log(result);
                    if (result.code == 0) {
                        url = result.url;
                        url.forEach(function (e) {
                            insertImg(e);
                        })
                    } else {
                        $.msg.error(result.msg);
                    }
                }
            }
            editor[i].customConfig.customAlert = function (info) {
                layer.msg(info);
            }
            $text[i] = $(this);
            editor[i].customConfig.onchange = function (html) {
                // 监控变化，同步更新到 textarea
                $text[i].val(html)
            }
            editor[i].create();
        })

        /**
         * 添加导入信息
         */
        $("#submitBtn").click(function () {
            $.request.post('{:url("$thisRequest")}', $('#formBox').serializeArray(), function (res) {
                $.msg.success(res.msg, function () {
                    $.tool.reload('open');
                });
            });
            return false;
        });
    })

</script>
{/block}